#include "apue.h"
int main(int argc, char **argv) {
	struct timespec ts[2];
	struct stat st;
	int fd;
	for (int i = 1; i < argc; i++) {
		if (stat(argv[i], &st) < 0) {
			err_ret("stat error");
			continue;
		}
		if ((fd = open(argv[i], O_RDWR | O_TRUNC)) < 0) {
			err_ret("%s: open error", argv[i]);
			continue;
		}
		ts[0] = st.st_atim;
		ts[1] = st.st_mtim;
		if (futimens(fd, ts) < 0) {
			err_ret("futimens error");
		}
		close(fd);
	}
	return 0;
}
